<!-- 帮助页面 -->
<template>
	<view class="container">
		<view class="cut"></view>
		<view class="contact">
			<image src="https://inclusivecommunity.oss-cn-chengdu.aliyuncs.com/attach/2020-07/11d8220200709195639894.png" mode=""></image>
			<view>
				<text>客服电话</text>
				<text>{{phone}}</text>
			</view>
			<button type="primary" class="btn" @tap="phoneCall(phone)">立即拨打</button>
		</view>
		<!-- #ifdef MP-WEIXIN -->
		<view class="cut"></view>
		<view class="cell">
			<view>
				线上客服
			</view>
			<button open-type="contact">
				立即联系
			</button>
		</view>
		<!-- #endif -->
		<view class="cut"></view>
		<view class="cell" @tap="goagency">
			<view>
				代理相关
			</view>
			<view>
				<text class="cell-more yticon icon-you"></text>
			</view>
		</view>
		<view class="cell" @tap="gorules">
			<view>
				用户协议规则
			</view>
			<view>
				<text class="cell-more yticon icon-you"></text>
			</view>
		</view>
		<view class="cut"></view>
		<uni-collapse accordion="true">
			<block v-for="(item,index) in essueList" :key="index">
				<uni-collapse-item :title="item.title">
					<rich-text style="padding: 30rpx; font-size: 24rpx;color: #999;" :nodes="item.description"></rich-text>
				</uni-collapse-item>
			</block>
		</uni-collapse>
	</view>
</template>

<script>
	import {
		protocolList
	} from '@/api/public.js'
	import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
	import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
	export default {
		components: {
			uniCollapse,
			uniCollapseItem
		},
		data() {
			return {
				phone: uni.getStorageSync('servicePhone'),
				siteSPhone: uni.getStorageSync('siteSerPhone'),
				essueList: []
			}
		},
		onLoad() {
			this.getEssueList();
		},
		methods: {
			getEssueList() { //问题列表
				protocolList({
					class_id: 5
				}).then(res => {
					this.essueList = res.data;
				})
			},
			phoneCall(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				})
			},
			goagency() {
				uni.navigateTo({
					url: "/pages/center/help/agency"
				})
			},
			gorules() {
				uni.navigateTo({
					url: "/pages/center/help/rules"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		.cut {
			background-color: #eee;
			height: 20rpx;
		}

		.contact {
			display: flex;
			padding: 40rpx 30rpx;
			position: relative;

			image {
				width: 120rpx;
				height: 120rpx;
				border-radius: 60rpx;
				background-color: $theme-color;
			}

			view {
				display: flex;
				flex-direction: column;
				justify-content: center;
				font-size: 30rpx;
				color: rgba(51, 51, 51, 1);
				margin-left: 30rpx;
			}

			.btn {
				position: absolute;
				background-color: #fff;
				right: 30rpx;
				top: 70rpx;
				width: 172rpx;
				height: 62rpx;
				line-height: 62rpx;
				color: $theme-color;
				font-size: 24rpx;
				border: 1rpx solid $theme-color;
				border-radius: 20rpx;
			}
		}

		.cell {
			position: relative;
			height: 42rpx;
			padding: 32rpx 30rpx;
			background: rgba(255, 255, 255, 1);
			border-bottom: 1rpx solid rgba(238, 238, 238, 1);
			display: flex;
			justify-content: space-between;

			button {
				position: absolute;
				background-color: #fff;
				right: 30rpx;
				top: 22rpx;
				width: 172rpx;
				height: 62rpx;
				line-height: 62rpx;
				color: $theme-color;
				font-size: 24rpx;
				border: 1rpx solid $theme-color;
				border-radius: 20rpx;
			}

			view:nth-of-type(1) {
				font-size: 30rpx;
				font-weight: 400;
				color: rgba(51, 51, 51, 1);
				line-height: 42rpx;
			}

			view:nth-of-type(2) {
				display: flex;
				line-height: 42rpx;

				text {
					margin-left: 10rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: rgba(153, 153, 153, 1);
				}
			}
		}
	}
</style>
